 package CurtainDesign;

 import CurtainDesign.utils.CalculateUtils;
 import CurtainDesign.utils.CurtainChecker;
 import CurtainDesign.utils.HingeRelatedInfo;
 import com.lowagie.text.Chunk;
 import com.lowagie.text.Document;
 import com.lowagie.text.DocumentException;
 import com.lowagie.text.Font;
 import com.lowagie.text.PageSize;
 import com.lowagie.text.Paragraph;
 import com.lowagie.text.Phrase;
 import com.lowagie.text.Rectangle;
 import com.lowagie.text.pdf.BaseFont;
 import com.lowagie.text.pdf.PdfPCell;
 import com.lowagie.text.pdf.PdfPTable;
 import com.lowagie.text.pdf.PdfWriter;
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.PrintStream;
 import java.text.DateFormat;
 import java.text.DecimalFormat;
 import java.text.NumberFormat;
 import java.text.SimpleDateFormat;
 import java.util.Calendar;
 import java.util.Date;
 import javax.swing.JOptionPane;

 public class ResultInfoByFold extends ResultInfo
 {
   private float m_HeaderLength;
   private float m_FrameLength;
   private float m_TopFasciaLength;
   private float m_SideLegHeight;
   private float m_SideFasciaHeight;
   private float m_PoleLength;
   private float m_DuiKouPoleLength;
   private float m_ShuanglianPoleLength;
   private float m_BeamLength;
   private float m_UpBeamWidth;
   private float m_DownBeamWidth;
   private int m_UpBeamNum;
   private int m_DownBeamNum;
   private float m_VaneLength;
   private int m_VaneNum;
   private float[] m_PullBarLength;
   private float m_DividerLength;
   private int[] m_DividerPos;
   private int m_HingeNum;
   private int m_DoubleHingeNum;
   private int m_BendHingeNum;
   private int m_VaneBoltNum;
   private int m_TenonNum;
   private int m_MagnetNum;
   private int m_MagnetSliceNum;
   private float m_TotalArea;
   private float m_BoardWidth;
   private float m_BoardHeight;
   private int m_PivotKitNum;
   private int m_RollerNum;
   private float m_TrackLength;

   public ResultInfoByFold()
   {
     this.m_OrderInfo = CurtainDesign.m_UserMainGUI.GetOrderInfo();
   }

   public boolean Output(String pathfile)
   {
     Output output = new Output();
     return output.OutputToPdfFile(pathfile);
   }

   public void DrawPic()
   {
   }

   public boolean Calculate()
   {
     CalculateRectSimple calculate = new CalculateRectSimple();
     return calculate.Exec();
   }

   public class Output
   {
     public Output()
     {
     }

     public boolean OutputToPdfFile(String filepath)
     {
       Rectangle rectPageSize = new Rectangle(PageSize.A4);
       Document doc = new Document(rectPageSize, 50.0F, 50.0F, 50.0F, 50.0F);
       try
       {
         PdfWriter.getInstance(doc, new FileOutputStream(filepath));

         doc.open();

         OutputFramePage(doc, rectPageSize);

         doc.newPage();

         OutputPanelPage(doc, rectPageSize);

         doc.close();
         return true;
       }
       catch (FileNotFoundException e)
       {
         e.printStackTrace();
         JOptionPane.showMessageDialog(null, e, "错误", 0);
         return false;
       }
       catch (DocumentException e) {
         e.printStackTrace();
         JOptionPane.showMessageDialog(null, e, "错误", 0);
       }return false;
     }

     public void OutputFramePage(Document doc, Rectangle rectPageSize)
     {
       try
       {
         BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", false);
         Font FontChinese = new Font(bfChinese, 10.0F, 0);
         Font FontChinese18 = new Font(bfChinese, 24.0F, 1);
         PdfPTable table = new PdfPTable(3);
         table.setWidthPercentage(100.0F);
         float[] widths = { 0.4F, 0.4F, 0.2F };
         table.setWidths(widths);
         PdfPCell cell = new PdfPCell();

         Paragraph para = new Paragraph();
         para.add(new Chunk("制造单号: ", FontChinese));
         para.add(new Chunk(ResultInfoByFold.this.m_OrderInfo.GetOrderIndex(), FontChinese18));
         cell.addElement(para);
         para = new Paragraph("");
         cell.addElement(para);

         Date orderDate = ResultInfoByFold.this.m_OrderInfo.GetOrderDate();
         DateFormat dtformat = new SimpleDateFormat("yyyy年MM月dd日");
         cell.addElement(new Paragraph(new Phrase("下单日期：" + dtformat.format(orderDate), FontChinese)));

         Date deliverDate = new Date(orderDate.getTime() + 691200000L);
         cell.addElement(new Paragraph("交货日期：" + dtformat.format(deliverDate), FontChinese));
         table.addCell(cell);

         String pipeIndex = ResultInfoByFold.this.m_OrderInfo.GetPipeIndex();
         String windowIndex = ResultInfoByFold.this.m_OrderInfo.GetWindowIndex();
         String windowNum = ResultInfoByFold.this.m_OrderInfo.GetWindowNum();
         String singleWindowIndex = pipeIndex + "-" + windowIndex + "/" + windowNum;
         cell = new PdfPCell();
         cell.addElement(new Paragraph("制造厂： 欣成木业", FontChinese));
         para = new Paragraph("");
         cell.addElement(para);

         para = new Paragraph();
         para.add(new Chunk("单窗制造单: ", FontChinese));
         Chunk tmp = new Chunk(singleWindowIndex, FontChinese18);
         tmp.setTextRise(-8.0F);
         para.add(tmp);

         cell.addElement(para);
         table.addCell(cell);
         System.out.println("windowIndex=" + singleWindowIndex);

         FontChinese = new Font(bfChinese, 10.0F, 0);
         int year = Calendar.getInstance().get(1);
         int month = Calendar.getInstance().get(2);
         int date = Calendar.getInstance().get(5);
         int hour = Calendar.getInstance().get(11);
         int minute = Calendar.getInstance().get(12);
         String dateprn = Integer.toString(year) + "-" + Integer.toString(month + 1) + "-" + Integer.toString(date);
         cell = new PdfPCell();
         cell.addElement(new Paragraph("打印日期 " + dateprn, FontChinese));
         cell.addElement(new Paragraph("打印时间 " + Integer.toString(hour) + ":" + Integer.toString(minute), FontChinese));
         table.addCell(cell);
         System.out.println("打印日期" + dateprn);

         doc.add(table);
       }
       catch (FileNotFoundException e)
       {
         e.printStackTrace();
       }
       catch (DocumentException e) {
         e.printStackTrace();
       }
       catch (IOException e) {
         e.printStackTrace();
       }

       // float width = rectPageSize.width();
       float width = 0; // todo
       try {
         BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", false);
         Font FontChinese = new Font(bfChinese, 10.0F, 0);
         Font FontChinese32 = new Font(bfChinese, 32.0F, 1);
         Font FontEnglish = new Font(0, 10.0F, 0);

         PdfPTable OutTable = new PdfPTable(2);
         OutTable.getDefaultCell().setBorder(0);
         OutTable.setWidthPercentage(100.0F);
         float[] widths = { 0.45F, 0.55F };
         OutTable.setWidths(widths);

         PdfPTable table = new PdfPTable(2);
         table.setWidthPercentage(30.0F);
         table.setWidths(widths);
         table.setHorizontalAlignment(0);

         PdfPCell cell = new PdfPCell();
         cell.addElement(new Paragraph("经销商(Dealer)", FontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         String clientRegion = ResultInfoByFold.this.m_OrderInfo.GetClientRegion();
         cell.addElement(new Paragraph(clientRegion, FontChinese));
         table.addCell(cell);

         cell = new PdfPCell();
         cell.addElement(new Paragraph("客户标签(Customer)", FontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         String custRefNum = ResultInfoByFold.this.m_OrderInfo.getCustRefNum();
         cell.addElement(new Paragraph(custRefNum, FontChinese));
         table.addCell(cell);

         cell = new PdfPCell();
         cell.addElement(new Paragraph("房间(Room)", FontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         String room = ResultInfoByFold.this.m_OrderInfo.GetRoom();
         cell.addElement(new Paragraph(room, FontChinese));
         table.addCell(cell);

         cell = new PdfPCell();
         cell.addElement(new Paragraph("窗号(Line number)#", FontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         cell.addElement(new Paragraph(ResultInfoByFold.this.m_OrderInfo.GetWindowIndex(), FontChinese));
         table.addCell(cell);

         cell = new PdfPCell();
         cell.addElement(new Paragraph("颜色(Color)", FontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         String color = ResultInfoByFold.this.m_OrderInfo.GetColor();
         cell.addElement(new Paragraph(color, FontChinese));
         table.addCell(cell);

         cell = new PdfPCell();
         cell.addElement(new Paragraph("宽(Width)", FontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         String oriWindowWidth = ResultInfoByFold.this.m_OrderInfo.GetOriWindowWidth();
         cell.addElement(new Paragraph(oriWindowWidth, FontChinese));
         table.addCell(cell);

         cell = new PdfPCell();
         cell.addElement(new Paragraph("高(Height)", FontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         String oriWindowHeight = ResultInfoByFold.this.m_OrderInfo.GetOriWindowHeight();
         cell.addElement(new Paragraph(oriWindowHeight, FontChinese));
         table.addCell(cell);

         cell = new PdfPCell();
         cell.addElement(new Paragraph("合页颜色(Color of hinge)", FontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         int hingeColor = ResultInfoByFold.this.m_OrderInfo.GetHingeColor();
         String strHingeColor = Constants.HINGECOLOR[hingeColor] + "(" + Constants.HINGECOLOR_EN[hingeColor].replaceAll("_", " ") + ")";

         cell.addElement(new Paragraph(strHingeColor, FontChinese));
         table.addCell(cell);

         cell = new PdfPCell();
         cell.addElement(new Paragraph("合页安装方式", FontChinese));
         cell.addElement(new Paragraph("(Shape and configuration)", FontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         String hingeInstallType = ResultInfoByFold.this.m_OrderInfo.GetHingeInstallType();
         cell.addElement(new Paragraph(hingeInstallType, FontChinese));
         table.addCell(cell);

         OutTable.addCell(table);

         cell = new PdfPCell();
         Paragraph para = new Paragraph();
         para = new Paragraph();
         cell.addElement(para);
         para = new Paragraph("外框部分", FontChinese32);
         para.setAlignment(1);
         cell.addElement(para);
         para = new Paragraph("ByFold/折叠型", FontChinese32);
         para.setAlignment(1);
         cell.addElement(para);

         OutTable.addCell(cell);

         doc.add(OutTable);
       }
       catch (FileNotFoundException e)
       {
         e.printStackTrace();
       }
       catch (DocumentException e) {
         e.printStackTrace();
       }
       catch (IOException e) {
         e.printStackTrace();
       }

       try
       {
         BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", false);
         Font FontChinese = new Font(bfChinese, 10.0F, 0);
         Font boldFontChinese = new Font(bfChinese, 10.0F, 1);
         PdfPTable table = new PdfPTable(6);
         table.setWidthPercentage(100.0F);
         table.setHorizontalAlignment(0);
         float[] widths = { 0.24F, 0.17F, 0.09F, 0.11F, 0.14F, 0.25F };
         table.setWidths(widths);

         PdfPCell cell = new PdfPCell();
         cell.addElement(new Paragraph("部件", boldFontChinese));
         cell.addElement(new Paragraph("(Components)", boldFontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         cell.addElement(new Paragraph("部件代号", boldFontChinese));
         cell.addElement(new Paragraph("(Components code)", boldFontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         cell.addElement(new Paragraph("数量", boldFontChinese));
         cell.addElement(new Paragraph("(Number)", boldFontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         cell.addElement(new Paragraph("长(单位mm)", boldFontChinese));
         cell.addElement(new Paragraph("(Length)", boldFontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         cell.addElement(new Paragraph("宽(高)(单位mm)", boldFontChinese));
         cell.addElement(new Paragraph("(Width)", boldFontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         cell.addElement(new Paragraph("备注", boldFontChinese));
         cell.addElement(new Paragraph("(Remark)", boldFontChinese));
         table.addCell(cell);

         DecimalFormat nFormat = new DecimalFormat();
         nFormat.setMaximumFractionDigits(2);
         nFormat.setGroupingSize(10);

         cell = new PdfPCell();
         cell.addElement(new Paragraph("Header/顶板", FontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         String strBeamType = Constants.BEAMCODE[1][ResultInfoByFold.this.m_OrderInfo.GetWoodOption()];
         cell.addElement(new Paragraph(strBeamType, FontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         cell.addElement(new Paragraph("1", FontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         cell.addElement(new Paragraph(nFormat.format(ResultInfoByFold.this.m_HeaderLength), FontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         cell.addElement(new Paragraph("108", FontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         cell.addElement(new Paragraph("", FontChinese));
         table.addCell(cell);

         cell = new PdfPCell();
         cell.addElement(new Paragraph("Side Leg/边腿", FontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         cell.addElement(new Paragraph(strBeamType, FontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         cell.addElement(new Paragraph("2", FontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         cell.addElement(new Paragraph(nFormat.format(ResultInfoByFold.this.m_SideLegHeight), FontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         cell.addElement(new Paragraph("108", FontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         cell.addElement(new Paragraph("", FontChinese));
         table.addCell(cell);

         cell = new PdfPCell();
         cell.addElement(new Paragraph("L Frame/L型外框", FontChinese));
         table.addCell(cell);
         cell = new PdfPCell();

         int woodOption = ResultInfoByFold.this.m_OrderInfo.GetWoodOption();
         String frameDescription = Constants.FRAMECODE[4][woodOption];

         cell.addElement(new Paragraph(frameDescription, FontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         cell.addElement(new Paragraph("1", FontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         cell.addElement(new Paragraph(nFormat.format(ResultInfoByFold.this.m_TrackLength), FontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         cell.addElement(new Paragraph("", FontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         cell.addElement(new Paragraph("", FontChinese));
         table.addCell(cell);

         cell = new PdfPCell();
         cell.addElement(new Paragraph("Track/轨道", FontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         cell.addElement(new Paragraph(Constants.TRACK[0], FontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         cell.addElement(new Paragraph("1", FontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         cell.addElement(new Paragraph(nFormat.format(ResultInfoByFold.this.m_TrackLength), FontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         cell.addElement(new Paragraph("", FontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         cell.addElement(new Paragraph("", FontChinese));
         table.addCell(cell);

         cell = new PdfPCell();
         cell.addElement(new Paragraph("Top Fascia/面板", FontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         cell.addElement(new Paragraph(Constants.FASCIA[0], FontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         cell.addElement(new Paragraph("1", FontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         cell.addElement(new Paragraph(nFormat.format(ResultInfoByFold.this.m_TopFasciaLength), FontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         cell.addElement(new Paragraph("", FontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         cell.addElement(new Paragraph("", FontChinese));
         table.addCell(cell);

         cell = new PdfPCell();
         cell.addElement(new Paragraph("Side Fascia/边板", FontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         cell.addElement(new Paragraph(Constants.FASCIA[1], FontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         cell.addElement(new Paragraph("2", FontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         cell.addElement(new Paragraph(nFormat.format(ResultInfoByFold.this.m_SideFasciaHeight), FontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         cell.addElement(new Paragraph("", FontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         cell.addElement(new Paragraph("", FontChinese));
         table.addCell(cell);

         if (ResultInfoByFold.this.m_OrderInfo.GetInstall().equalsIgnoreCase(Constants.INSTALL[1])) {
           cell = new PdfPCell();
           cell.addElement(new Paragraph("Corner Fascia/角板", FontChinese));
           table.addCell(cell);
           cell = new PdfPCell();
           cell.addElement(new Paragraph(Constants.FASCIA[2], FontChinese));
           table.addCell(cell);
           cell = new PdfPCell();
           cell.addElement(new Paragraph("2", FontChinese));
           table.addCell(cell);
           cell = new PdfPCell();
           cell.addElement(new Paragraph("108", FontChinese));
           table.addCell(cell);
           cell = new PdfPCell();
           cell.addElement(new Paragraph("", FontChinese));
           table.addCell(cell);
           cell = new PdfPCell();
           cell.addElement(new Paragraph("", FontChinese));
           table.addCell(cell);
         }

         doc.add(table);
       }
       catch (FileNotFoundException e)
       {
         e.printStackTrace();
       }
       catch (DocumentException e) {
         e.printStackTrace();
       }
       catch (IOException e) {
         e.printStackTrace();
       }

       try
       {
         BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", false);
         Font FontChinese = new Font(bfChinese, 10.0F, 0);
         PdfPTable table = new PdfPTable(1);
         table.setWidthPercentage(100.0F);
         table.setHorizontalAlignment(0);

         DecimalFormat nFormat = new DecimalFormat();
         nFormat.setMaximumFractionDigits(2);
         nFormat.setGroupingSize(10);

         PdfPCell cell = new PdfPCell();

         cell.addElement(new Paragraph("轨道长： mm/毫米: " + nFormat.format(ResultInfoByFold.this.m_TrackLength), FontChinese));
         table.addCell(cell);

         doc.add(table);
       }
       catch (FileNotFoundException e) {
         e.printStackTrace();
       }
       catch (DocumentException e) {
         e.printStackTrace();
       }
       catch (IOException e) {
         e.printStackTrace();
       }

       try
       {
         BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", false);
         Font FontChinese = new Font(bfChinese, 10.0F, 0);
         PdfPTable table = new PdfPTable(3);
         String comments = ResultInfoByFold.this.m_OrderInfo.GetComments();
         System.out.println("the comments are: " + comments);
         if ((comments == null) || (comments.equals(""))) {
           return;
         }
         doc.add(new Paragraph("备注", FontChinese));

         String[] strComments = comments.split("@@");
		 int rowNum = strComments.length % (Constants.TABLESIZE[1] - 1) == 0 ? strComments.length / (Constants.TABLESIZE[1] - 1) : strComments.length / (Constants.TABLESIZE[1] - 1) + 1;

         for (int i = 0; i < rowNum; i++)
         {
           for (int j = 0; j < Constants.TABLESIZE[1] - 1; j++)
           {
             if (i * (Constants.TABLESIZE[1] - 1) + j < strComments.length)
             {
               PdfPCell cell = new PdfPCell();
               cell.addElement(new Paragraph(strComments[(i * (Constants.TABLESIZE[1] - 1) + j)], FontChinese));
               table.addCell(cell);
             }
             else
             {
               PdfPCell cell = new PdfPCell();
               cell.addElement(new Paragraph(""));
               table.addCell(cell);
             }
           }
         }
         doc.add(table);
       }
       catch (FileNotFoundException e)
       {
         e.printStackTrace();
       }
       catch (DocumentException e) {
         e.printStackTrace();
       }
       catch (IOException e) {
         e.printStackTrace();
       }
     }

     public void OutputPanelPage(Document doc, Rectangle rectPageSize)
     {
       try
       {
         BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", false);
         Font FontChinese = new Font(bfChinese, 10.0F, 0);
         Font FontChinese18 = new Font(bfChinese, 24.0F, 1);
         PdfPTable table = new PdfPTable(3);
         table.setWidthPercentage(100.0F);
         float[] widths = { 0.4F, 0.4F, 0.2F };
         table.setWidths(widths);
         PdfPCell cell = new PdfPCell();

         Paragraph para = new Paragraph();
         para.add(new Chunk("制造单号: ", FontChinese));
         para.add(new Chunk(ResultInfoByFold.this.m_OrderInfo.GetOrderIndex(), FontChinese18));
         cell.addElement(para);
         para = new Paragraph("");
         cell.addElement(para);

         Date orderDate = ResultInfoByFold.this.m_OrderInfo.GetOrderDate();
         DateFormat dtformat = new SimpleDateFormat("yyyy年MM月dd日");
         cell.addElement(new Paragraph(new Phrase("下单日期：" + dtformat.format(orderDate), FontChinese)));

         Date deliverDate = new Date(orderDate.getTime() + 691200000L);
         cell.addElement(new Paragraph("交货日期：" + dtformat.format(deliverDate), FontChinese));
         table.addCell(cell);

         String pipeIndex = ResultInfoByFold.this.m_OrderInfo.GetPipeIndex();
         String windowIndex = ResultInfoByFold.this.m_OrderInfo.GetWindowIndex();
         String windowNum = ResultInfoByFold.this.m_OrderInfo.GetWindowNum();
         String singleWindowIndex = pipeIndex + "-" + windowIndex + "/" + windowNum;
         cell = new PdfPCell();
         cell.addElement(new Paragraph("制造厂： 欣成木业", FontChinese));
         para = new Paragraph("");
         cell.addElement(para);

         para = new Paragraph();
         para.add(new Chunk("单窗制造单: ", FontChinese));
         Chunk tmp = new Chunk(singleWindowIndex, FontChinese18);
         tmp.setTextRise(-8.0F);
         para.add(tmp);

         cell.addElement(para);
         table.addCell(cell);
         System.out.println("windowIndex=" + singleWindowIndex);

         FontChinese = new Font(bfChinese, 10.0F, 0);
         int year = Calendar.getInstance().get(1);
         int month = Calendar.getInstance().get(2);
         int date = Calendar.getInstance().get(5);
         int hour = Calendar.getInstance().get(11);
         int minute = Calendar.getInstance().get(12);
         String dateprn = Integer.toString(year) + "-" + Integer.toString(month + 1) + "-" + Integer.toString(date);
         cell = new PdfPCell();

         cell.addElement(new Paragraph("打印日期 " + dateprn, FontChinese));
         cell.addElement(new Paragraph("打印时间 " + Integer.toString(hour) + ":" + Integer.toString(minute), FontChinese));
         table.addCell(cell);
         System.out.println("打印日期" + dateprn);

         doc.add(table);
       }
       catch (FileNotFoundException e)
       {
         e.printStackTrace();
       }
       catch (DocumentException e) {
         e.printStackTrace();
       }
       catch (IOException e) {
         e.printStackTrace();
       }

       // float width = rectPageSize.width();
       float width = 0;
       try {
         BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", false);
         Font FontChinese = new Font(bfChinese, 10.0F, 0);
         Font FontChinese32 = new Font(bfChinese, 32.0F, 1);
         Font FontEnglish = new Font(0, 10.0F, 0);

         PdfPTable OutTable = new PdfPTable(2);
         OutTable.getDefaultCell().setBorder(0);
         OutTable.setWidthPercentage(100.0F);
         float[] widths = { 0.45F, 0.55F };
         OutTable.setWidths(widths);

         PdfPTable table = new PdfPTable(2);
         table.setWidthPercentage(30.0F);
         table.setWidths(widths);
         table.setHorizontalAlignment(0);

         PdfPCell cell = new PdfPCell();
         cell.addElement(new Paragraph("经销商(Dealer)", FontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         String clientRegion = ResultInfoByFold.this.m_OrderInfo.GetClientRegion();
         cell.addElement(new Paragraph(clientRegion, FontChinese));
         table.addCell(cell);

         cell = new PdfPCell();
         cell.addElement(new Paragraph("客户标签(Customer)", FontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         String custRefNum = ResultInfoByFold.this.m_OrderInfo.getCustRefNum();
         cell.addElement(new Paragraph(custRefNum, FontChinese));
         table.addCell(cell);

         cell = new PdfPCell();
         cell.addElement(new Paragraph("房间(Room)", FontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         String room = ResultInfoByFold.this.m_OrderInfo.GetRoom();
         cell.addElement(new Paragraph(room, FontChinese));
         table.addCell(cell);

         cell = new PdfPCell();
         cell.addElement(new Paragraph("窗号(Line number)#", FontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         cell.addElement(new Paragraph(ResultInfoByFold.this.m_OrderInfo.GetWindowIndex(), FontChinese));
         table.addCell(cell);

         cell = new PdfPCell();
         cell.addElement(new Paragraph("颜色(Color)", FontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         String color = ResultInfoByFold.this.m_OrderInfo.GetColor();
         cell.addElement(new Paragraph(color, FontChinese));
         table.addCell(cell);

         cell = new PdfPCell();
         cell.addElement(new Paragraph("宽(Width)", FontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         String oriWindowWidth = ResultInfoByFold.this.m_OrderInfo.GetOriWindowWidth();
         cell.addElement(new Paragraph(oriWindowWidth, FontChinese));
         table.addCell(cell);

         cell = new PdfPCell();
         cell.addElement(new Paragraph("高(Height)", FontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         String oriWindowHeight = ResultInfoByFold.this.m_OrderInfo.GetOriWindowHeight();
         cell.addElement(new Paragraph(oriWindowHeight, FontChinese));
         table.addCell(cell);

         cell = new PdfPCell();
         cell.addElement(new Paragraph("合页颜色(Color of hinge)", FontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         int hingeColor = ResultInfoByFold.this.m_OrderInfo.GetHingeColor();
         String strHingeColor = Constants.HINGECOLOR[hingeColor] + "(" + Constants.HINGECOLOR_EN[hingeColor].replaceAll("_", " ") + ")";

         cell.addElement(new Paragraph(strHingeColor, FontChinese));
         table.addCell(cell);

         cell = new PdfPCell();
         cell.addElement(new Paragraph("合页安装方式(Configuration)", FontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         String hingeInstallType = ResultInfoByFold.this.m_OrderInfo.GetHingeInstallType();
         cell.addElement(new Paragraph(hingeInstallType, FontChinese));
         table.addCell(cell);

         int woodOption = ResultInfoByFold.this.m_OrderInfo.GetWoodOption();
         String frameDescription = Constants.FRAMECODE[4][woodOption];
         cell.addElement(new Paragraph("", FontChinese));

         DecimalFormat nFormat = new DecimalFormat();
         nFormat.setMaximumFractionDigits(2);
         nFormat.setGroupingSize(10);

         OutTable.addCell(table);

         cell = new PdfPCell();
         Paragraph para = new Paragraph();
         para = new Paragraph();
         cell.addElement(para);
         para = new Paragraph("窗扇部分", new Font(bfChinese, 30.0F, 0));
         para.setAlignment(1);
         cell.addElement(para);
         para = new Paragraph("ByFold/折叠型", new Font(bfChinese, 30.0F, 0));
         para.setAlignment(1);
         cell.addElement(para);

         para = new Paragraph(hingeInstallType, new Font(bfChinese, 30.0F, 0));
         para.setAlignment(1);
         cell.addElement(para);

         int pullBarType = ResultInfoByFold.this.m_OrderInfo.GetPullBarType();
         String strPullBarDes;
         String strPullBarType;
         if (pullBarType == 0) {
           strPullBarDes = "普通拉杆(Tilt rod)";
           strPullBarType = Constants.PULLBAR[woodOption];
         }
         else
         {
           if (pullBarType == 1) {
             strPullBarDes = "隐式拉杆(Hidden tilt rod)";
             strPullBarType = Constants.ALUMBAR[ResultInfoByFold.this.m_OrderInfo.GetVaneType()];
           }
           else {
             strPullBarDes = "偏拉杆";
             strPullBarType = Constants.PULLBAR[woodOption];
           }
         }
         para = new Paragraph(strPullBarDes + "   " + strPullBarType, FontChinese32);
         para.setAlignment(1);
         cell.addElement(para);

         OutTable.addCell(cell);

         doc.add(OutTable);
       }
       catch (FileNotFoundException e)
       {
         e.printStackTrace();
       }
       catch (DocumentException e) {
         e.printStackTrace();
       }
       catch (IOException e) {
         e.printStackTrace();
       }

       try
       {
         BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", false);
         Font fontChinese = new Font(bfChinese, 10.0F, 0);
         Font boldFontChinese = new Font(bfChinese, 10.0F, 1);
         PdfPTable table = new PdfPTable(6);
         table.setWidthPercentage(100.0F);
         table.setHorizontalAlignment(0);
         float[] widths = { 0.15F, 0.2F, 0.1F, 0.15F, 0.15F, 0.25F };
         table.setWidths(widths);

         PdfPCell cell = new PdfPCell();
         cell.addElement(new Paragraph("部件", boldFontChinese));
         cell.addElement(new Paragraph("(Components)", boldFontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         cell.addElement(new Paragraph("部件代号", boldFontChinese));
         cell.addElement(new Paragraph("(Components code)", boldFontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         cell.addElement(new Paragraph("数量", boldFontChinese));
         cell.addElement(new Paragraph("(Number)", boldFontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         cell.addElement(new Paragraph("长(单位mm)", boldFontChinese));
         cell.addElement(new Paragraph("(Length)", boldFontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         cell.addElement(new Paragraph("宽(高)(单位mm)", boldFontChinese));
         cell.addElement(new Paragraph("(Width)", boldFontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         cell.addElement(new Paragraph("备注", boldFontChinese));
         cell.addElement(new Paragraph("(Remark)", boldFontChinese));
         table.addCell(cell);

         DecimalFormat nFormat = new DecimalFormat();
         nFormat.setMaximumFractionDigits(2);
         nFormat.setGroupingSize(10);

         int woodOption = ResultInfoByFold.this.m_OrderInfo.GetWoodOption();

         cell = new PdfPCell();
         cell.addElement(new Paragraph("立杆(Stile)", fontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         String poleType = Constants.STILECODE[1][woodOption];
         cell.addElement(new Paragraph(poleType, fontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         int poleNum = Integer.parseInt(ResultInfoByFold.this.m_OrderInfo.GetPoleNum());
         cell.addElement(new Paragraph(Integer.toString(poleNum), fontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         cell.addElement(new Paragraph(nFormat.format(ResultInfoByFold.this.m_PoleLength), fontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         cell.addElement(new Paragraph(""));
         table.addCell(cell);
         cell = new PdfPCell();
         cell.addElement(new Paragraph(""));
         table.addCell(cell);

         int duikouPoleNum = 0;
         if (!CurtainChecker.isEmpty(ResultInfoByFold.this.m_OrderInfo.GetDuiKouPoleNum()))
         {
           duikouPoleNum = Integer.parseInt(ResultInfoByFold.this.m_OrderInfo.GetDuiKouPoleNum());
         }
         if (duikouPoleNum > 0) {
           cell = new PdfPCell();
           cell.addElement(new Paragraph("对口立杆(Rebate stile)", fontChinese));
           table.addCell(cell);
           cell = new PdfPCell();
           String duikouPoleType = Constants.STILECODE[0][woodOption];
           cell.addElement(new Paragraph(duikouPoleType, fontChinese));
           table.addCell(cell);
           cell = new PdfPCell();
           cell.addElement(new Paragraph(Integer.toString(duikouPoleNum), fontChinese));
           table.addCell(cell);
           cell = new PdfPCell();
           cell.addElement(new Paragraph(nFormat.format(ResultInfoByFold.this.m_DuiKouPoleLength), fontChinese));
           table.addCell(cell);
           cell = new PdfPCell();
           cell.addElement(new Paragraph(""));
           table.addCell(cell);
           cell = new PdfPCell();
           cell.addElement(new Paragraph(""));
           table.addCell(cell);
         }
         int shuanglianPoleNum = 0;
         if (!CurtainChecker.isEmpty(ResultInfoByFold.this.m_OrderInfo.getShuangLianPoleNum()))
         {
           shuanglianPoleNum = Integer.parseInt(ResultInfoByFold.this.m_OrderInfo.getShuangLianPoleNum());
         }
         if (shuanglianPoleNum > 0)
         {
           shuanglianPoleNum = Integer.parseInt(ResultInfoByFold.this.m_OrderInfo.getShuangLianPoleNum());
           cell = new PdfPCell();
           cell.addElement(new Paragraph("双连立杆(Connect stile)", fontChinese));
           table.addCell(cell);
           cell = new PdfPCell();
           String shuanglianPoleType = Constants.STILECODE[2][woodOption];
           cell.addElement(new Paragraph(shuanglianPoleType, fontChinese));
           table.addCell(cell);
           cell = new PdfPCell();
           cell.addElement(new Paragraph(Integer.toString(shuanglianPoleNum), fontChinese));
           table.addCell(cell);
           cell = new PdfPCell();
           cell.addElement(new Paragraph(nFormat.format(ResultInfoByFold.this.m_ShuanglianPoleLength), fontChinese));
           table.addCell(cell);
           cell = new PdfPCell();
           cell.addElement(new Paragraph(""));
           table.addCell(cell);
           cell = new PdfPCell();
           cell.addElement(new Paragraph(""));
           table.addCell(cell);
         }

         String upBeamCode = "";
         if (ResultInfoByFold.this.m_UpBeamWidth <= 101.6F) {
           upBeamCode = Constants.BEAMCODE[0][woodOption];
         }
         else if ((ResultInfoByFold.this.m_UpBeamWidth > 101.6F) && (ResultInfoByFold.this.m_UpBeamWidth <= 127.0F))
         {
           upBeamCode = Constants.BEAMCODE[1][woodOption];
         }
         else if ((ResultInfoByFold.this.m_UpBeamWidth > 127.0F) && (ResultInfoByFold.this.m_UpBeamWidth <= 152.39999F)) {
           upBeamCode = Constants.BEAMCODE[2][woodOption];
         }
         String downBeamCode = "";
         if (ResultInfoByFold.this.m_DownBeamWidth <= 101.6F) {
           downBeamCode = Constants.BEAMCODE[0][woodOption];
         }
         else if ((ResultInfoByFold.this.m_DownBeamWidth > 101.6F) && (ResultInfoByFold.this.m_DownBeamWidth <= 127.0F))
         {
           downBeamCode = Constants.BEAMCODE[1][woodOption];
         }
         else if ((ResultInfoByFold.this.m_DownBeamWidth > 127.0F) && (ResultInfoByFold.this.m_DownBeamWidth <= 152.39999F)) {
           upBeamCode = Constants.BEAMCODE[2][woodOption];
         }
         if (ResultInfoByFold.this.m_UpBeamWidth == ResultInfoByFold.this.m_DownBeamWidth)
         {
           cell = new PdfPCell();
           cell.addElement(new Paragraph("横梁(Rail)", fontChinese));
           table.addCell(cell);
           cell = new PdfPCell();
           cell.addElement(new Paragraph(upBeamCode, fontChinese));
           table.addCell(cell);
           cell = new PdfPCell();
           cell.addElement(new Paragraph(Integer.toString(ResultInfoByFold.this.m_UpBeamNum + ResultInfoByFold.this.m_DownBeamNum), fontChinese));
           table.addCell(cell);
           cell = new PdfPCell();
           cell.addElement(new Paragraph(nFormat.format(ResultInfoByFold.this.m_BeamLength), fontChinese));
           table.addCell(cell);
           cell = new PdfPCell();
           cell.addElement(new Paragraph(nFormat.format(ResultInfoByFold.this.m_UpBeamWidth), fontChinese));
           table.addCell(cell);
           cell = new PdfPCell();
           cell.addElement(new Paragraph(""));
           table.addCell(cell);
         }
         else
         {
           cell = new PdfPCell();
           cell.addElement(new Paragraph("上横梁(Top rail)", fontChinese));
           table.addCell(cell);

           cell = new PdfPCell();
           cell.addElement(new Paragraph(upBeamCode, fontChinese));
           table.addCell(cell);

           cell = new PdfPCell();
           cell.addElement(new Paragraph(Integer.toString(ResultInfoByFold.this.m_UpBeamNum), fontChinese));
           table.addCell(cell);

           cell = new PdfPCell();
           cell.addElement(new Paragraph(nFormat.format(ResultInfoByFold.this.m_BeamLength), fontChinese));
           table.addCell(cell);

           cell = new PdfPCell();
           cell.addElement(new Paragraph(nFormat.format(ResultInfoByFold.this.m_UpBeamWidth), fontChinese));
           table.addCell(cell);

           cell = new PdfPCell();
           cell.addElement(new Paragraph(""));
           table.addCell(cell);

           cell = new PdfPCell();
           cell.addElement(new Paragraph("下横梁(Bottom rail)", fontChinese));
           table.addCell(cell);

           cell = new PdfPCell();
           cell.addElement(new Paragraph(downBeamCode, fontChinese));
           table.addCell(cell);

           cell = new PdfPCell();
           cell.addElement(new Paragraph(Integer.toString(ResultInfoByFold.this.m_DownBeamNum), fontChinese));
           table.addCell(cell);

           cell = new PdfPCell();
           cell.addElement(new Paragraph(nFormat.format(ResultInfoByFold.this.m_BeamLength), fontChinese));
           table.addCell(cell);

           cell = new PdfPCell();
           cell.addElement(new Paragraph(nFormat.format(ResultInfoByFold.this.m_DownBeamWidth), fontChinese));
           table.addCell(cell);

           cell = new PdfPCell();
           cell.addElement(new Paragraph(""));
           table.addCell(cell);
         }

         int vaneType = ResultInfoByFold.this.m_OrderInfo.GetVaneType();

         if (!ResultInfoByFold.this.m_OrderInfo.getIsBoard())
         {
           cell = new PdfPCell();
           cell.addElement(new Paragraph("叶片(Louver)", fontChinese));
           table.addCell(cell);
           cell = new PdfPCell();
           String strVaneType = Constants.VANECODE[vaneType][woodOption];
           cell.addElement(new Paragraph(strVaneType, fontChinese));
           table.addCell(cell);
           cell = new PdfPCell();
           cell.addElement(new Paragraph(Integer.toString(ResultInfoByFold.this.m_VaneNum), fontChinese));
           table.addCell(cell);
           cell = new PdfPCell();
           cell.addElement(new Paragraph(nFormat.format(ResultInfoByFold.this.m_VaneLength), fontChinese));
           table.addCell(cell);
           cell = new PdfPCell();
           cell.addElement(new Paragraph(""));
           table.addCell(cell);
           cell = new PdfPCell();
           cell.addElement(new Paragraph(""));
           table.addCell(cell);

           int dividerNum = 0;
           if (ResultInfoByFold.this.m_DividerPos != null)
           {
             dividerNum = ResultInfoByFold.this.m_DividerPos.length;
           }
           Integer.parseInt(ResultInfoByFold.this.m_OrderInfo.GetDividerNum());
           int pullBarType = ResultInfoByFold.this.m_OrderInfo.GetPullBarType();
           String strPullBarType;
           if ((pullBarType == 0) || (pullBarType == 2)) {
             strPullBarType = Constants.PULLBAR[woodOption];
           }
           else {
             strPullBarType = Constants.ALUMBAR[vaneType];
           }
           int loop = 0;
           do {
             cell = new PdfPCell();
             cell.addElement(new Paragraph("拉杆(Stile)" + Integer.toString(loop), fontChinese));
             table.addCell(cell);
             cell = new PdfPCell();
             cell.addElement(new Paragraph(strPullBarType, fontChinese));
             table.addCell(cell);
             cell = new PdfPCell();
             int pullBarNum = Integer.parseInt(ResultInfoByFold.this.m_OrderInfo.GetPanelNum());
             cell.addElement(new Paragraph(Integer.toString(pullBarNum), fontChinese));
             table.addCell(cell);
             cell = new PdfPCell();

             cell.addElement(new Paragraph(nFormat.format(ResultInfoByFold.this.m_PullBarLength[loop]), fontChinese));
             table.addCell(cell);
             cell = new PdfPCell();
             cell.addElement(new Paragraph(""));
             table.addCell(cell);
             cell = new PdfPCell();
             cell.addElement(new Paragraph(""));
             table.addCell(cell);

             loop++;
           }
           while (loop <= dividerNum);

           int dividerType = ResultInfoByFold.this.m_OrderInfo.GetDividerType();
           String strDividerType = "";
           if (dividerNum != 0) {
             strDividerType = Constants.DIVIDERBEAMCODE[dividerType][woodOption];
           }
           if (dividerNum > 0)
           {
             cell = new PdfPCell();
             cell.addElement(new Paragraph("分隔梁(Divider rail)", fontChinese));
             table.addCell(cell);

             cell = new PdfPCell();
             cell.addElement(new Paragraph(strDividerType, fontChinese));
             table.addCell(cell);

             cell = new PdfPCell();
             int cnt = Integer.parseInt(ResultInfoByFold.this.m_OrderInfo.GetPanelNum()) * dividerNum;
             cell.addElement(new Paragraph(Integer.toString(cnt), fontChinese));
             table.addCell(cell);

             cell = new PdfPCell();
             cell.addElement(new Paragraph(nFormat.format(ResultInfoByFold.this.m_DividerLength), fontChinese));
             table.addCell(cell);

             cell = new PdfPCell();
             cell.addElement(new Paragraph(""));
             table.addCell(cell);

             cell = new PdfPCell();

             String dividerDesc = "";
             int tempVaneNum = 0;
             for (int i = 0; i < dividerNum; i++) {
               tempVaneNum += ResultInfoByFold.this.m_DividerPos[i];
               dividerDesc = "/" + Integer.toString(ResultInfoByFold.this.m_DividerPos[i]) + dividerDesc;
             }
             int leftVaneNum = ResultInfoByFold.this.m_VaneNum / Integer.parseInt(ResultInfoByFold.this.m_OrderInfo.GetPanelNum()) - tempVaneNum;
             dividerDesc = "分隔梁的位置为(Divider rail's position)：" + Integer.toString(leftVaneNum) + dividerDesc;
             cell.addElement(new Paragraph(dividerDesc, fontChinese));
             table.addCell(cell);
           }

         }
         else
         {
           cell = new PdfPCell();
           cell.addElement(new Paragraph("实木", fontChinese));
           table.addCell(cell);

           cell = new PdfPCell();
           cell.addElement(new Paragraph("BOARD", fontChinese));
           table.addCell(cell);

           int boardNum = Integer.parseInt(ResultInfoByFold.this.m_OrderInfo.GetPanelNum());
           cell = new PdfPCell();
           cell.addElement(new Paragraph(Integer.toString(boardNum), fontChinese));
           table.addCell(cell);

           cell = new PdfPCell();
           cell.addElement(new Paragraph(nFormat.format(ResultInfoByFold.this.m_BoardWidth), fontChinese));
           table.addCell(cell);

           cell = new PdfPCell();
           cell.addElement(new Paragraph(nFormat.format(ResultInfoByFold.this.m_BoardHeight), fontChinese));
           table.addCell(cell);

           cell = new PdfPCell();
           cell.addElement(new Paragraph(""));
           table.addCell(cell);
         }

         cell = new PdfPCell();
         cell.addElement(new Paragraph("Pivot Kit/枢纽工具", fontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         cell.addElement(new Paragraph("PCPIVOT", fontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         cell.addElement(new Paragraph(Integer.toString(ResultInfoByFold.this.m_PivotKitNum), fontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         cell.addElement(new Paragraph("", fontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         cell.addElement(new Paragraph("", fontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         cell.addElement(new Paragraph(""));
         table.addCell(cell);

         cell = new PdfPCell();
         cell.addElement(new Paragraph("Roller/轨道车", fontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         cell.addElement(new Paragraph("PCROLLER", fontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         cell.addElement(new Paragraph(Integer.toString(ResultInfoByFold.this.m_RollerNum), fontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         cell.addElement(new Paragraph(""));
         table.addCell(cell);
         cell = new PdfPCell();
         cell.addElement(new Paragraph(""));
         table.addCell(cell);
         cell = new PdfPCell();
         cell.addElement(new Paragraph(""));
         table.addCell(cell);

         if (ResultInfoByFold.this.m_HingeNum > 0) {
           cell = new PdfPCell();
           cell.addElement(new Paragraph("单开合页(Hinge)", fontChinese));
           table.addCell(cell);
           cell = new PdfPCell();
           cell.addElement(new Paragraph(Constants.HINGECODE[1], fontChinese));
           table.addCell(cell);
           cell = new PdfPCell();
           cell.addElement(new Paragraph(Integer.toString(ResultInfoByFold.this.m_HingeNum), fontChinese));
           table.addCell(cell);
           cell = new PdfPCell();
           cell.addElement(new Paragraph(""));
           table.addCell(cell);
           cell = new PdfPCell();
           cell.addElement(new Paragraph(""));
           table.addCell(cell);
           cell = new PdfPCell();
           cell.addElement(new Paragraph(""));
           table.addCell(cell);
         }

         if (ResultInfoByFold.this.m_DoubleHingeNum > 0) {
           cell = new PdfPCell();
           cell.addElement(new Paragraph("双开合页", fontChinese));
           table.addCell(cell);
           cell = new PdfPCell();
           cell.addElement(new Paragraph(Constants.HINGECODE[2], fontChinese));
           table.addCell(cell);
           cell = new PdfPCell();
           cell.addElement(new Paragraph(Integer.toString(ResultInfoByFold.this.m_DoubleHingeNum), fontChinese));
           table.addCell(cell);
           cell = new PdfPCell();
           cell.addElement(new Paragraph(""));
           table.addCell(cell);
           cell = new PdfPCell();
           cell.addElement(new Paragraph(""));
           table.addCell(cell);
           cell = new PdfPCell();
           cell.addElement(new Paragraph(""));
           table.addCell(cell);
         }

         if (ResultInfoByFold.this.m_BendHingeNum > 0)
         {
           cell = new PdfPCell();
           cell.addElement(new Paragraph("弯曲合页(Rebate hinge)", fontChinese));
           table.addCell(cell);
           cell = new PdfPCell();
           cell.addElement(new Paragraph(Constants.HINGECODE[0], fontChinese));
           table.addCell(cell);
           cell = new PdfPCell();
           cell.addElement(new Paragraph(Integer.toString(ResultInfoByFold.this.m_BendHingeNum), fontChinese));
           table.addCell(cell);
           cell = new PdfPCell();
           cell.addElement(new Paragraph(""));
           table.addCell(cell);
           cell = new PdfPCell();
           cell.addElement(new Paragraph(""));
           table.addCell(cell);
           cell = new PdfPCell();
           cell.addElement(new Paragraph(""));
           table.addCell(cell);
         }

         if (ResultInfoByFold.this.m_MagnetNum > 0) {
           cell = new PdfPCell();
           cell.addElement(new Paragraph("磁碰(Magnet)", fontChinese));
           table.addCell(cell);
           cell = new PdfPCell();
           String megnetCode = "";
           if (ResultInfoByFold.this.m_OrderInfo.IsRoundMagnet())
           {
             megnetCode = Constants.PCMAG[1];
           }
           else
           {
             megnetCode = Constants.PCMAG[0];
           }
           cell.addElement(new Paragraph(megnetCode, fontChinese));
           table.addCell(cell);
           cell = new PdfPCell();
           cell.addElement(new Paragraph(Integer.toString(ResultInfoByFold.this.m_MagnetNum), fontChinese));
           table.addCell(cell);
           cell = new PdfPCell();
           cell.addElement(new Paragraph(""));
           table.addCell(cell);
           cell = new PdfPCell();
           cell.addElement(new Paragraph(""));
           table.addCell(cell);
           cell = new PdfPCell();
           cell.addElement(new Paragraph(""));
           table.addCell(cell);
         }

         if (ResultInfoByFold.this.m_VaneBoltNum > 0)
         {
           cell = new PdfPCell();
           cell.addElement(new Paragraph("叶片销", fontChinese));
           table.addCell(cell);
           cell = new PdfPCell();
           String pC1PIN = "PC1PIN";
           cell.addElement(new Paragraph(pC1PIN, fontChinese));
           table.addCell(cell);
           cell = new PdfPCell();
           cell.addElement(new Paragraph(Integer.toString(ResultInfoByFold.this.m_VaneBoltNum), fontChinese));
           table.addCell(cell);
           cell = new PdfPCell();
           cell.addElement(new Paragraph(""));
           table.addCell(cell);
           cell = new PdfPCell();
           cell.addElement(new Paragraph(""));
           table.addCell(cell);
           cell = new PdfPCell();
           cell.addElement(new Paragraph(""));
           table.addCell(cell);
         }

         cell = new PdfPCell();
         cell.addElement(new Paragraph("木榫", fontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         String tenonCode = "WDDOWEL";
         cell.addElement(new Paragraph(tenonCode, fontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         cell.addElement(new Paragraph(Integer.toString(ResultInfoByFold.this.m_TenonNum), fontChinese));
         table.addCell(cell);
         cell = new PdfPCell();
         cell.addElement(new Paragraph(""));
         table.addCell(cell);
         cell = new PdfPCell();
         cell.addElement(new Paragraph(""));
         table.addCell(cell);
         cell = new PdfPCell();
         cell.addElement(new Paragraph(""));
         table.addCell(cell);

         int magnetNum = ResultInfoByFold.this.m_OrderInfo.getMagnetSliceNum();
         if (magnetNum > 0)
         {
           cell = new PdfPCell();
           cell.addElement(new Paragraph("磁碰(Magnet)", fontChinese));
           table.addCell(cell);
           cell = new PdfPCell();
           String megnetCode = "";
           if (ResultInfoByFold.this.m_OrderInfo.IsRoundMagnet())
           {
             megnetCode = Constants.PCMAG[1];
           }
           else
           {
             megnetCode = Constants.PCMAG[0];
           }
           cell.addElement(new Paragraph(megnetCode, fontChinese));
           table.addCell(cell);
           cell = new PdfPCell();
           cell.addElement(new Paragraph(Integer.toString(magnetNum), fontChinese));
           table.addCell(cell);
           cell = new PdfPCell();
           cell.addElement(new Paragraph(""));
           table.addCell(cell);
           cell = new PdfPCell();
           cell.addElement(new Paragraph(""));
           table.addCell(cell);
           cell = new PdfPCell();
           cell.addElement(new Paragraph(""));
           table.addCell(cell);
         }

         doc.add(table);
       }
       catch (FileNotFoundException e)
       {
         e.printStackTrace();
       }
       catch (DocumentException e) {
         e.printStackTrace();
       }
       catch (IOException e) {
         e.printStackTrace();
       }

       try
       {
         BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", false);
         Font fontChinese = new Font(bfChinese, 10.0F, 0);
         PdfPTable table = new PdfPTable(1);
         table.setWidthPercentage(100.0F);
         table.setHorizontalAlignment(0);

         NumberFormat nFormat = NumberFormat.getNumberInstance();
         nFormat.setMaximumFractionDigits(2);

         PdfPCell cell = new PdfPCell();

         cell.addElement(new Paragraph("总计： 平方米: " + nFormat.format(ResultInfoByFold.this.m_TotalArea / 1000000.0F), fontChinese));
         table.addCell(cell);

         doc.add(table);
       }
       catch (FileNotFoundException e) {
         e.printStackTrace();
       }
       catch (DocumentException e) {
         e.printStackTrace();
       }
       catch (IOException e) {
         e.printStackTrace();
       }
       try
       {
         BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", false);
         Font fontChinese = new Font(bfChinese, 10.0F, 0);
         PdfPTable table = new PdfPTable(3);
         String comments = ResultInfoByFold.this.m_OrderInfo.GetComments();
         System.out.println("the comments are: " + comments);
         if ((comments == null) || (comments.equals(""))) {
           return;
         }
         doc.add(new Paragraph("备注", fontChinese));

         String[] strComments = comments.split("@@");
		   int rowNum = strComments.length % (Constants.TABLESIZE[1] - 1) == 0 ? strComments.length / (Constants.TABLESIZE[1] - 1) : strComments.length / (Constants.TABLESIZE[1] - 1) + 1;

         for (int i = 0; i < rowNum; i++)
         {
           for (int j = 0; j < Constants.TABLESIZE[1] - 1; j++)
           {
             if (i * (Constants.TABLESIZE[1] - 1) + j < strComments.length)
             {
               PdfPCell cell = new PdfPCell();
               cell.addElement(new Paragraph(strComments[(i * (Constants.TABLESIZE[1] - 1) + j)], fontChinese));
               table.addCell(cell);
             }
             else
             {
               PdfPCell cell = new PdfPCell();
               cell.addElement(new Paragraph(""));
               table.addCell(cell);
             }
           }
         }
         doc.add(table);
       }
       catch (FileNotFoundException e)
       {
         e.printStackTrace();
       }
       catch (DocumentException e) {
         e.printStackTrace();
       }
       catch (IOException e) {
         e.printStackTrace();
       }
     }
   }

   public class CalculateRectSimple
   {
     public CalculateRectSimple()
     {
     }

     public boolean Exec()
     {
       calculateHeaderLengthTrackLength();
       calculateTopFasciaLength();
       calculateSideLegHeight();
       calculateSideFasciaHeight();
       calculatePoleLength();
       if (!calculateBeamLength())
         return false;
       calVaneLength();
       calMagnetNum();
       if (!calculateVaneNumBeamWidth())
         return false;
       calBeamNum();
       if (!calDividerPos())
         return false;
       calPullBarLength();
       calDividerLength();
       calBoardWidthAndHeight();
       if (!calHingeNum())
         return false;
       calVaneBoltNum();
       calTenonNum();
       calTotalArea();
       calPivotKitNum();
       calRollerNum();

       return true;
     }

     public void calculateHeaderLengthTrackLength()
     {
       // ResultInfoByFold.access$002(ResultInfoByFold.this, Float.parseFloat(ResultInfoByFold.this.m_OrderInfo.GetOriWindowWidth()));

       // ResultInfoByFold.access$102(ResultInfoByFold.this, ResultInfoByFold.this.m_HeaderLength - 53.98F);
     }

     public void calculateTopFasciaLength()
     {
       // ResultInfoByFold.access$202(ResultInfoByFold.this, ResultInfoByFold.this.m_HeaderLength);
     }

     public void calculateSideLegHeight()
     {
       // ResultInfoByFold.access$302(ResultInfoByFold.this, Float.parseFloat(ResultInfoByFold.this.m_OrderInfo.GetOriWindowHeight()) - 25.4F);
     }

     public void calculateSideFasciaHeight()
     {
       // ResultInfoByFold.access$402(ResultInfoByFold.this, ResultInfoByFold.this.m_SideLegHeight - 38.099998F);
     }

     public void calculatePoleLength()
     {
       // ResultInfoByFold.access$502(ResultInfoByFold.this, ResultInfoByFold.this.m_SideLegHeight - 66.68F);
       // ResultInfoByFold.access$602(ResultInfoByFold.this, ResultInfoByFold.this.m_PoleLength);
       // ResultInfoByFold.access$702(ResultInfoByFold.this, ResultInfoByFold.this.m_PoleLength);
     }

     public boolean calculateBeamLength()
     {
       float gap = Float.parseFloat(ResultInfoByFold.this.m_OrderInfo.GetGap());
       int poleNum = Integer.parseInt(ResultInfoByFold.this.m_OrderInfo.GetPoleNum());
       int duiKouPoleNum = 0;
       if (!CurtainChecker.isEmpty(ResultInfoByFold.this.m_OrderInfo.getShuangLianPoleNum())) {
         duiKouPoleNum = Integer.parseInt(ResultInfoByFold.this.m_OrderInfo.GetDuiKouPoleNum());
       }
       int shuanglianPoleNum = 0;
       if (!CurtainChecker.isEmpty(ResultInfoByFold.this.m_OrderInfo.getShuangLianPoleNum())) {
         shuanglianPoleNum = Integer.parseInt(ResultInfoByFold.this.m_OrderInfo.getShuangLianPoleNum());
       }
       int panelNum = Integer.parseInt(ResultInfoByFold.this.m_OrderInfo.GetPanelNum());
       // ResultInfoByFold.access$802(ResultInfoByFold.this, (ResultInfoByFold.this.m_HeaderLength - 50.799999F - gap - poleNum * 50.799999F - (duiKouPoleNum + shuanglianPoleNum) * 48.02F) / panelNum);

       return true;
     }

     public void calVaneLength()
     {
       // ResultInfoByFold.access$902(ResultInfoByFold.this, ResultInfoByFold.this.m_BeamLength - 1.59F);
     }

     public void calMagnetNum()
     {
       HingeRelatedInfo info = CalculateUtils.getByFoldHingeRelatedInfo(CurtainDesign.m_UserMainGUI.GetOrderInfo().GetHingeInstallType());
       // ResultInfoByFold.access$1002(ResultInfoByFold.this, info.getMagnetSliceNum());
     }

     public boolean calculateVaneNumBeamWidth()
     {
       if (!ResultInfoByFold.this.m_OrderInfo.getIsBoard())
       {
         float poleLength = ResultInfoByFold.this.m_PoleLength;
         int dividerNum = 0;
         float dividerWidth = 0.0F;
         if ((!CurtainChecker.isEmpty(ResultInfoByFold.this.m_OrderInfo.GetDividerNum())) && (Integer.parseInt(ResultInfoByFold.this.m_OrderInfo.GetDividerNum()) > 0))
         {
           dividerNum = Integer.parseInt(ResultInfoByFold.this.m_OrderInfo.GetDividerNum());
           dividerWidth = Float.parseFloat(Constants.DIVIDERTYPE[ResultInfoByFold.this.m_OrderInfo.GetDividerType()]);
         }
         else if (CurtainDesign.m_UserMainGUI.GetOrderInfo().getAutoAddDivider())
         {
           int vaneType = ResultInfoByFold.this.m_OrderInfo.GetVaneType();
           if ((!CurtainChecker.isEmpty(ResultInfoByFold.this.m_OrderInfo.GetPoleNum())) && (Integer.parseInt(ResultInfoByFold.this.m_OrderInfo.GetPoleNum()) > 0))
           {
             if ((vaneType == 0) || (vaneType == 2)) {
               dividerWidth = Float.parseFloat(Constants.DIVIDERTYPE[2]);
               ResultInfoByFold.this.m_OrderInfo.SaveDividerType(2);
             }
             else if (vaneType == 1) {
               dividerWidth = Float.parseFloat(Constants.DIVIDERTYPE[0]);
               ResultInfoByFold.this.m_OrderInfo.SaveDividerType(0);
             }
             else if (vaneType == 3)
             {
               dividerWidth = Float.parseFloat(Constants.DIVIDERTYPE[1]);
               ResultInfoByFold.this.m_OrderInfo.SaveDividerType(1);
             }
             else
             {
               dividerWidth = Float.parseFloat(Constants.DIVIDERTYPE[3]);
               ResultInfoByFold.this.m_OrderInfo.SaveDividerType(3);
             }

             if ((vaneType == 4) && (ResultInfoByFold.this.m_PoleLength >= 1100.0F))
             {
               dividerNum = 1;
             }

             if (((vaneType == 0) || (vaneType == 1) || (vaneType == 2) || (vaneType == 3)) && (ResultInfoByFold.this.m_PoleLength >= 1600.0F))
             {
               dividerNum = 1;
             }
           }

         }

         float minBeamWidth = 0.0F;
         float tmpVaneNum = 0.0F;
         int vaneNum = 0;
         int vaneType = ResultInfoByFold.this.m_OrderInfo.GetVaneType();
         float vaneWidth = Float.parseFloat(Constants.VANETYPE[vaneType]);
         if (vaneType == 0) {
           minBeamWidth = 105.4F;
           tmpVaneNum = (poleLength - dividerWidth * dividerNum - minBeamWidth * 2.0F) / (vaneWidth - 12.7F);
           vaneNum = StrictMath.round(tmpVaneNum);
           minBeamWidth = (poleLength - dividerWidth * dividerNum - vaneNum * (vaneWidth - 12.7F)) / 2.0F;
         }
         else if (vaneType == 1) {
           minBeamWidth = 114.3F;
           tmpVaneNum = (poleLength - dividerWidth * dividerNum - minBeamWidth * 2.0F) / (vaneWidth - 12.7F);
           vaneNum = StrictMath.round(tmpVaneNum);
           minBeamWidth = (poleLength - dividerWidth * dividerNum - vaneNum * (vaneWidth - 12.7F)) / 2.0F;
         }
         else if (vaneType == 2) {
           minBeamWidth = 133.35001F;
           tmpVaneNum = (poleLength - dividerWidth * dividerNum - minBeamWidth * 2.0F) / (vaneWidth - 12.7F);
           vaneNum = StrictMath.round(tmpVaneNum);
           minBeamWidth = (poleLength - dividerWidth * dividerNum - vaneNum * (vaneWidth - 12.7F)) / 2.0F;
         }
         else if (vaneType == 3) {
           minBeamWidth = 100.0F;
           tmpVaneNum = (poleLength - dividerWidth * dividerNum - minBeamWidth * 2.0F) / (vaneWidth - 8.0F);
           vaneNum = StrictMath.round(tmpVaneNum);
           minBeamWidth = (poleLength - dividerWidth * dividerNum - vaneNum * (vaneWidth - 8.0F)) / 2.0F;
         }
         else if (vaneType == 4) {
           minBeamWidth = 87.5F;
           tmpVaneNum = (poleLength - dividerWidth * dividerNum - minBeamWidth * 2.0F) / (vaneWidth - 6.0F);
           vaneNum = StrictMath.round(tmpVaneNum);
           minBeamWidth = (poleLength - dividerWidth * dividerNum - vaneNum * (vaneWidth - 6.0F)) / 2.0F;
         }

         if (vaneType == 0)
         {
           while (true)
           {
             if (minBeamWidth < 80.0F)
             {
               vaneNum--;
               minBeamWidth = (poleLength - dividerWidth * dividerNum - vaneNum * (vaneWidth - 12.7F)) / 2.0F;
               continue;
             }if (minBeamWidth <= 130.8F)
               break;
             vaneNum++;
             minBeamWidth = (poleLength - dividerWidth * dividerNum - vaneNum * (vaneWidth - 12.7F)) / 2.0F;
           }

           float halfVaneWidth = (vaneWidth - 12.7F) / 2.0F;

           if (minBeamWidth - halfVaneWidth >= 80.0F)
           {
             while (true)
             {
               minBeamWidth -= halfVaneWidth;
               vaneNum++;
               if (minBeamWidth - halfVaneWidth < 80.0F)
               {
                 break;
               }

             }

           }

           //ResultInfoByFold.access$1102(ResultInfoByFold.this, minBeamWidth);
           //ResultInfoByFold.access$1202(ResultInfoByFold.this, minBeamWidth);
         }
         if (vaneType == 1)
         {
           while (true)
           {
             if (minBeamWidth < 76.199997F)
             {
               vaneNum--;
               minBeamWidth = (poleLength - dividerWidth * dividerNum - vaneNum * (vaneWidth - 12.7F)) / 2.0F;
               continue;
             }if (minBeamWidth <= 152.39999F)
               break;
             vaneNum++;
             minBeamWidth = (poleLength - dividerWidth * dividerNum - vaneNum * (vaneWidth - 12.7F)) / 2.0F;
           }

           float halfVaneWidth = (vaneWidth - 12.7F) / 2.0F;

           if (minBeamWidth - halfVaneWidth >= 76.199997F)
           {
             while (true)
             {
               minBeamWidth -= halfVaneWidth;
               vaneNum++;
               if (minBeamWidth - halfVaneWidth < 76.199997F)
               {
                 break;
               }

             }

           }

           //ResultInfoByFold.access$1102(ResultInfoByFold.this, minBeamWidth);
           //ResultInfoByFold.access$1202(ResultInfoByFold.this, minBeamWidth);
         }
         if (vaneType == 2)
         {
           if ((minBeamWidth >= 114.3F) && (minBeamWidth <= 152.40000000000001D))
           {
             //ResultInfoByFold.access$1102(ResultInfoByFold.this, minBeamWidth);
             //ResultInfoByFold.access$1202(ResultInfoByFold.this, minBeamWidth);

             float halfVaneWidth = (vaneWidth - 12.7F) / 2.0F;

             if (minBeamWidth - halfVaneWidth >= 114.3F)
             {
               while (true)
               {
                 minBeamWidth -= halfVaneWidth;
                 vaneNum++;
                 if (minBeamWidth - halfVaneWidth < 114.3F)
                 {
                   break;
                 }
               }
             }
           }
           else if (minBeamWidth < 114.3F)
           {
             if (minBeamWidth * 2.0F > 114.3F)
             {
               //ResultInfoByFold.access$1202(ResultInfoByFold.this, 114.3F);
               //ResultInfoByFold.access$1102(ResultInfoByFold.this, minBeamWidth * 2.0F - 114.3F);
             }
             else
             {
               do
               {
                 vaneNum--;
                 minBeamWidth = (poleLength - dividerWidth * dividerNum - vaneNum * (vaneWidth - 12.7F)) / 2.0F;
                 if ((minBeamWidth < 114.3F) || (minBeamWidth > 152.39999F))
                   continue;
                 //ResultInfoByFold.access$1102(ResultInfoByFold.this, minBeamWidth);
                 //ResultInfoByFold.access$1202(ResultInfoByFold.this, minBeamWidth);
                 break;
               }
               while ((minBeamWidth >= 114.3F) ||
                 (minBeamWidth * 2.0F <= 114.3F));

               //ResultInfoByFold.access$1202(ResultInfoByFold.this, 114.3F);
               //ResultInfoByFold.access$1102(ResultInfoByFold.this, minBeamWidth * 2.0F - 114.3F);
             }

           }
           else
           {
             while (true)
             {
               vaneNum++;
               minBeamWidth = (poleLength - dividerWidth * dividerNum - vaneNum * (vaneWidth - 12.7F)) / 2.0F;
               if ((minBeamWidth >= 114.3F) && (minBeamWidth <= 152.39999F))
               {
                 //ResultInfoByFold.access$1102(ResultInfoByFold.this, minBeamWidth);
                 //ResultInfoByFold.access$1202(ResultInfoByFold.this, minBeamWidth);
               }
               else {
                 if (minBeamWidth >= 114.3F)
                   continue;
                 if (minBeamWidth * 2.0F > 114.3F)
                 {
                   //ResultInfoByFold.access$1202(ResultInfoByFold.this, 114.3F);
                   //ResultInfoByFold.access$1102(ResultInfoByFold.this, minBeamWidth * 2.0F - 114.3F);
                 }
                 else
                 {
                   //ResultInfoByFold.access$1202(ResultInfoByFold.this, 114.3F);
                   //ResultInfoByFold.access$1102(ResultInfoByFold.this, minBeamWidth * 2.0F);
                 }
               }
             }
           }
         }

         if (vaneType == 3)
         {
           while (true)
           {
             if (minBeamWidth < 80.0F)
             {
               vaneNum--;
               minBeamWidth = (poleLength - dividerWidth * dividerNum - vaneNum * (vaneWidth - 8.0F)) / 2.0F;
               continue;
             }if (minBeamWidth <= 120.0F)
               break;
             vaneNum++;
             minBeamWidth = (poleLength - dividerWidth * dividerNum - vaneNum * (vaneWidth - 8.0F)) / 2.0F;
           }

           float halfVaneWidth = (vaneWidth - 8.0F) / 2.0F;

           if (minBeamWidth - halfVaneWidth >= 80.0F)
           {
             while (true)
             {
               minBeamWidth -= halfVaneWidth;
               vaneNum++;
               if (minBeamWidth - halfVaneWidth < 80.0F)
               {
                 break;
               }

             }

           }

           //ResultInfoByFold.access$1102(ResultInfoByFold.this, minBeamWidth + 2.3F);
           // ResultInfoByFold.access$1202(ResultInfoByFold.this, minBeamWidth + 2.3F);
         }
         if (vaneType == 4)
         {
           while (true)
           {
             if (minBeamWidth < 75.0F)
             {
               vaneNum--;
               minBeamWidth = (poleLength - dividerWidth * dividerNum - vaneNum * (vaneWidth - 6.0F)) / 2.0F;
               continue;
             }if (minBeamWidth <= 100.0F)
               break;
             vaneNum++;
             minBeamWidth = (poleLength - dividerWidth * dividerNum - vaneNum * (vaneWidth - 6.0F)) / 2.0F;
           }

           float halfVaneWidth = (vaneWidth - 6.0F) / 2.0F;

           if (minBeamWidth - halfVaneWidth >= 75.0F)
           {
             while (true)
             {
               minBeamWidth -= halfVaneWidth;
               vaneNum++;
               if (minBeamWidth - halfVaneWidth < 75.0F)
               {
                 break;
               }

             }

           }

           //ResultInfoByFold.access$1102(ResultInfoByFold.this, minBeamWidth);
           // ResultInfoByFold.access$1202(ResultInfoByFold.this, minBeamWidth);
         }

         // ResultInfoByFold.access$1302(ResultInfoByFold.this, vaneNum * Integer.parseInt(ResultInfoByFold.this.m_OrderInfo.GetPanelNum()));
       }
       else
       {
         //ResultInfoByFold.access$1102(ResultInfoByFold.this, 100.0F);
         // ResultInfoByFold.access$1202(ResultInfoByFold.this, 100.0F);
       }
       return true;
     }

     public void calBeamNum()
     {
       //ResultInfoByFold.access$1402(ResultInfoByFold.this, Integer.parseInt(ResultInfoByFold.this.m_OrderInfo.GetPanelNum()));
       //ResultInfoByFold.access$1502(ResultInfoByFold.this, ResultInfoByFold.this.m_UpBeamNum);
     }

     public boolean calDividerPos()
     {
       if (!ResultInfoByFold.this.m_OrderInfo.getIsBoard())
       {
         int dividerNum = Integer.parseInt(ResultInfoByFold.this.m_OrderInfo.GetDividerNum());
         if (dividerNum == 0)
         {
           if (ResultInfoByFold.this.m_OrderInfo.getAutoAddDivider())
           {
             int vaneType = ResultInfoByFold.this.m_OrderInfo.GetVaneType();
             if (((vaneType == 0) || (vaneType == 1) || (vaneType == 2) || (vaneType == 3)) && (ResultInfoByFold.this.m_PoleLength >= 1600.0F))
             {
               if (ResultInfoByFold.this.m_VaneNum / Integer.parseInt(ResultInfoByFold.this.m_OrderInfo.GetPanelNum()) > 1)
               {
				   int num = ResultInfoByFold.this.m_VaneNum % (2 * Integer.parseInt(ResultInfoByFold.this.m_OrderInfo.GetPanelNum())) == 0 ? ResultInfoByFold.this.m_VaneNum / (2 * Integer.parseInt(ResultInfoByFold.this.m_OrderInfo.GetPanelNum())) : ResultInfoByFold.this.m_VaneNum / (2 * Integer.parseInt(ResultInfoByFold.this.m_OrderInfo.GetPanelNum())) + 1;

                 // ResultInfoByFold.access$1602(ResultInfoByFold.this, new int[] { num });
               }

             }
             else if ((vaneType == 4) && (ResultInfoByFold.this.m_PoleLength >= 1100.0F))
             {
               if (ResultInfoByFold.this.m_VaneNum / Integer.parseInt(ResultInfoByFold.this.m_OrderInfo.GetPanelNum()) > 1)
               {
				   int num = ResultInfoByFold.this.m_VaneNum % (2 * Integer.parseInt(ResultInfoByFold.this.m_OrderInfo.GetPanelNum())) == 0 ? ResultInfoByFold.this.m_VaneNum / (2 * Integer.parseInt(ResultInfoByFold.this.m_OrderInfo.GetPanelNum())) : ResultInfoByFold.this.m_VaneNum / (2 * Integer.parseInt(ResultInfoByFold.this.m_OrderInfo.GetPanelNum())) + 1;

                 // ResultInfoByFold.access$1602(ResultInfoByFold.this, new int[] { num });
               }
             }
           }

           return true;
         }

         // ResultInfoByFold.access$1602(ResultInfoByFold.this, new int[dividerNum]);

         int vaneNum = ResultInfoByFold.this.m_VaneNum / Integer.parseInt(ResultInfoByFold.this.m_OrderInfo.GetPanelNum());
         int vaneType = ResultInfoByFold.this.m_OrderInfo.GetVaneType();
         float vaneWidth = Float.parseFloat(Constants.VANETYPE[vaneType]);
         String strPos = ResultInfoByFold.this.m_OrderInfo.GetDivederPos();
         String[] strPosTmp = strPos.split(",");

         float overlapSize = 0.0F;
         switch (vaneType)
         {
         case 0:
           overlapSize = 12.7F;
           break;
         case 1:
           overlapSize = 12.7F;
           break;
         case 2:
           overlapSize = 12.7F;
           break;
         case 3:
           overlapSize = 8.0F;
           break;
         case 4:
           overlapSize = 6.0F;
         }

         int downVaneNum = 0;
         float fDownVaneNum = 0.0F;
         float dividerWidth = Float.parseFloat(Constants.DIVIDERTYPE[ResultInfoByFold.this.m_OrderInfo.GetDividerType()]);
         for (int i = 0; i < dividerNum; i++)
         {
           if (i == 0)
           {
			   fDownVaneNum = (Float.parseFloat(strPosTmp[i]) - ResultInfoByFold.this.m_DownBeamWidth - dividerWidth / 2.0F - 24.0F) / (vaneWidth - overlapSize);
           }
           else {
             fDownVaneNum = (Float.parseFloat(strPosTmp[i]) - Float.parseFloat(strPosTmp[(i - 1)]) - dividerWidth) / (vaneWidth - overlapSize);
           }
           if (fDownVaneNum < 1.0F)
           {
             JOptionPane.showMessageDialog(null, "分隔梁位置太低，不合理，请检查", "错误", 0);
             return false;
           }
           if (fDownVaneNum > vaneNum - 1)
           {
             JOptionPane.showMessageDialog(null, "分隔梁位置太高，不合理，请检查", "错误", 0);
             return false;
           }
           downVaneNum = StrictMath.round(fDownVaneNum);
           ResultInfoByFold.this.m_DividerPos[i] = downVaneNum;
         }

         int aboveDivider = 0;
         int aboveVaneNum = 0;
         float height = 0.0F;
         float distance = 0.0F;
         for (int i = 0; i < dividerNum; i++) {
           aboveDivider = i;
           aboveVaneNum += ResultInfoByFold.this.m_DividerPos[i];

           if (i == 0)
           {
             height = aboveDivider * dividerWidth + dividerWidth / 2.0F + 24.0F + ResultInfoByFold.this.m_DownBeamWidth + aboveVaneNum * (vaneWidth - overlapSize);
           }
           else
           {
             height = aboveDivider * dividerWidth + dividerWidth / 2.0F + ResultInfoByFold.this.m_DownBeamWidth + aboveVaneNum * (vaneWidth - overlapSize);
           }

           distance = height - Float.parseFloat(strPosTmp[i]);
           if (Math.abs(distance) > dividerWidth / 2.0F) {
             if (distance > 0.0F) {
               aboveVaneNum--;
               // ResultInfoByFold.this.m_DividerPos[i] = (ResultInfoByFold.access$1600(ResultInfoByFold.this)[i] - 1);
               if (i != dividerNum - 1){
				   // ResultInfoByFold.this.m_DividerPos[(i + 1)] = (ResultInfoByFold.access$1600(ResultInfoByFold.this)[(i + 1)] + 1);
			   }
             }
             else
             {
               aboveVaneNum++;
               // ResultInfoByFold.this.m_DividerPos[i] = (ResultInfoByFold.access$1600(ResultInfoByFold.this)[i] - 1);
               if (i == dividerNum - 1)
                 continue;
               // ResultInfoByFold.this.m_DividerPos[(i + 1)] = (ResultInfoByFold.access$1600(ResultInfoByFold.this)[(i + 1)] - 1);
             }
           }
         }
       }

       return true;
     }

     public void calPullBarLength()
     {
       if (!ResultInfoByFold.this.m_OrderInfo.getIsBoard())
       {
         int dividerNum = 0;
         if (ResultInfoByFold.this.m_DividerPos != null)
         {
           dividerNum = ResultInfoByFold.this.m_DividerPos.length;
         }
         // ResultInfoByFold.access$1702(ResultInfoByFold.this, new float[4]);
         int vaneType = ResultInfoByFold.this.m_OrderInfo.GetVaneType();
         float vaneWidth = Float.parseFloat(Constants.VANETYPE[vaneType]);
         int vaneNum = ResultInfoByFold.this.m_VaneNum / Integer.parseInt(ResultInfoByFold.this.m_OrderInfo.GetPanelNum());
         int pullBarType = ResultInfoByFold.this.m_OrderInfo.GetPullBarType();

         float overlapSize = 0.0F;
         float muchWidth = 0.0F;
         switch (vaneType)
         {
         case 0:
           overlapSize = 12.7F;
           break;
         case 1:
           overlapSize = 12.7F;
           break;
         case 2:
           overlapSize = 12.7F;
           break;
         case 3:
           overlapSize = 8.0F;
           muchWidth = 2.3F;
           break;
         case 4:
           overlapSize = 6.0F;
         }

         if (pullBarType == 1)
         {
           int totalVaneNumDownLastDivider = 0;
           int i = 0;
           for (i = 0; i < dividerNum; i++) {
             int downVaneNum = ResultInfoByFold.this.m_DividerPos[i];
             ResultInfoByFold.this.m_PullBarLength[i] = ((vaneWidth - overlapSize) * (downVaneNum - 1) + 9.525F - muchWidth);
             totalVaneNumDownLastDivider += ResultInfoByFold.this.m_DividerPos[i];
           }

           int vaneNumUpLastDivider = vaneNum - totalVaneNumDownLastDivider;
           ResultInfoByFold.this.m_PullBarLength[i] = ((vaneWidth - overlapSize) * (vaneNumUpLastDivider - 1) + 9.525F - muchWidth);
         }
         else {
           int totalVaneNumDownLastDivider = 0;
           int i = 0;
           for (i = 0; i < dividerNum; i++) {
             int downVaneNum = ResultInfoByFold.this.m_DividerPos[i];
             ResultInfoByFold.this.m_PullBarLength[i] = ((vaneWidth - overlapSize) * (downVaneNum - 1) + 31.75F - muchWidth);
             totalVaneNumDownLastDivider += ResultInfoByFold.this.m_DividerPos[i];
           }

           int vaneNumUpLastDivider = vaneNum - totalVaneNumDownLastDivider;
           ResultInfoByFold.this.m_PullBarLength[i] = ((vaneWidth - overlapSize) * (vaneNumUpLastDivider - 1) + 31.75F - muchWidth);
         }
         return;
       }
     }

     public void calDividerLength()
     {
       //ResultInfoByFold.access$1802(ResultInfoByFold.this, ResultInfoByFold.this.m_BeamLength);
     }

     public void calBoardWidthAndHeight()
     {
       if (ResultInfoByFold.this.m_OrderInfo.getIsBoard())
       {
         //ResultInfoByFold.access$1902(ResultInfoByFold.this, ResultInfoByFold.this.m_PoleLength - (ResultInfoByFold.this.m_UpBeamWidth + ResultInfoByFold.this.m_DownBeamWidth) + 20.0F);
         //ResultInfoByFold.access$2002(ResultInfoByFold.this, ResultInfoByFold.this.m_BeamLength + 20.0F);
       }
     }

     public boolean calHingeNum()
     {
       int hingePanelNum = 0;
       if (!CurtainChecker.isEmpty(ResultInfoByFold.this.m_OrderInfo.GetSingleHinge()))
       {
         hingePanelNum = Integer.parseInt(ResultInfoByFold.this.m_OrderInfo.GetSingleHinge());
       }
       int doublePaneNum = 0;
       if (!CurtainChecker.isEmpty(ResultInfoByFold.this.m_OrderInfo.GetDoubleHinge()))
       {
         doublePaneNum = Integer.parseInt(ResultInfoByFold.this.m_OrderInfo.GetDoubleHinge());
       }
       int bendPaneNum = 0;
       if (!CurtainChecker.isEmpty(ResultInfoByFold.this.m_OrderInfo.getBendHinge()))
       {
         bendPaneNum = Integer.parseInt(ResultInfoByFold.this.m_OrderInfo.getBendHinge());
       }
       int D = 0;
       if (ResultInfoByFold.this.m_PoleLength <= 1200.0F)
       {
         D = 2;
       }
       else if (ResultInfoByFold.this.m_PoleLength <= 2000.0F)
       {
         D = 3;
       }
       else if (ResultInfoByFold.this.m_PoleLength <= 2400.0F)
       {
         D = 4;
       }
       else if (ResultInfoByFold.this.m_PoleLength > 2400.0F)
       {
         D = 5;
       }

       //ResultInfoByFold.access$2102(ResultInfoByFold.this, hingePanelNum * D);
       //ResultInfoByFold.access$2202(ResultInfoByFold.this, doublePaneNum * D);
       //ResultInfoByFold.access$2302(ResultInfoByFold.this, bendPaneNum * D);
       return true;
     }

     public void calVaneBoltNum()
     {
       //ResultInfoByFold.access$2402(ResultInfoByFold.this, ResultInfoByFold.this.m_VaneNum * 2);
     }

     public void calTenonNum()
     {
       int E = 0;
       float downBeamWidth = ResultInfoByFold.this.m_DownBeamWidth;
       if (downBeamWidth < 127.0F)
       {
         E = 4;
       }
       else
       {
         E = 6;
       }

       int F = 4;
       int dividerNum = 0;
       if (!CurtainChecker.isEmpty(ResultInfoByFold.this.m_OrderInfo.GetDividerNum()))
       {
         dividerNum = Integer.parseInt(ResultInfoByFold.this.m_OrderInfo.GetDividerNum());
       }
       int result = (E * 2 + F * dividerNum) * Integer.parseInt(ResultInfoByFold.this.m_OrderInfo.GetPanelNum());

       //ResultInfoByFold.access$2502(ResultInfoByFold.this, result);
     }

     public void calTotalArea()
     {
       String strTmp = ResultInfoByFold.this.m_OrderInfo.GetOriWindowWidth();
       float origWinWidth = Float.parseFloat(strTmp);
       String strOriWinHeight = ResultInfoByFold.this.m_OrderInfo.GetOriWindowHeight();
       float origWinHeight = Float.parseFloat(strOriWinHeight);
       //ResultInfoByFold.access$2602(ResultInfoByFold.this, origWinWidth * origWinHeight);
     }

     public void calPivotKitNum()
     {
       String hingeInstallType = ResultInfoByFold.this.m_OrderInfo.GetHingeInstallType();
       if ((hingeInstallType.indexOf('L') != -1) && (hingeInstallType.indexOf('R') != -1))
       {
         //ResultInfoByFold.access$2702(ResultInfoByFold.this, 2);
       }
       else
       {
         //ResultInfoByFold.access$2702(ResultInfoByFold.this, 1);
       }
     }

     public void calRollerNum()
     {
       //ResultInfoByFold.access$2802(ResultInfoByFold.this, Integer.parseInt(ResultInfoByFold.this.m_OrderInfo.GetPanelNum()) / 2);
     }
   }
 }

/* Location:           C:\Users\Administrator\Desktop\奥特百叶窗\Shutter DesignerV3.1\CurtainDesign.jar
 * Qualified Name:     CurtainDesign.ResultInfoByFold
 * JD-Core Version:    0.6.0
 */